import moment from 'moment';

export const searchProps = [
  // {
  //   type: 'input',
  //   value: 'channelId',
  //   name: '用户名',
  //   style: {
  //     width: '180px',
  //   },
  //   placeholder: '请输入',
  // },
  {
    type: 'select_input_one',
    value: 'channelId',
    name: '渠道',
    selectOptions: [],
    placeholder: '请选择',
    style: {
      width: '180px',
    },
  },
  {
    type: 'select',
    value: 'type',
    name: '类型',
    selectOptions: [
      {
        label: '同业',
        value: 0,
      },
      {
        label: '信息流',
        value: 1,
      },
    ],
    placeholder: '请选择',
    style: {
      width: '180px',
    },
  },
];

const typeMap = {
  0: '同业',
  1: '信息流',
};

const shareMap = {
  0: '单价',
  1: '分润',
};

export const columns = [
  {
    title: '序号',
    dataIndex: 'index',
    width: 70,
    customRender: (text, record, index) => `${index + 1}`,
  },
  {
    dataIndex: 'id',
    title: '渠道ID',
    ellipsis: true,
    width: 200,
    customRender: (text) => text || '/',
  },
  {
    dataIndex: 'channelName',
    title: '名称',
    ellipsis: true,
    width: 150,
    customRender: (text) => text || '/',
  },
  {
    dataIndex: 'companyName',
    title: '公司名称',
    ellipsis: true,
    width: 150,
    customRender: (text) => text || '/',
  },
  {
    dataIndex: 'channelCode',
    title: '渠道签名',
    ellipsis: true,
    width: 100,
    customRender: (text) => text || '/',
  },
  {
    dataIndex: 'type',
    title: '类型',
    ellipsis: true,
    width: 100,
    customRender: (text) => typeMap[text] || '/',
  },
  {
    dataIndex: 'promotionUrl',
    title: '推广地址',
    ellipsis: true,
    width: 100,
    scopedSlots: { customRender: 'promotionUrl' },
  },
  {
    dataIndex: 'shareProfit',
    title: '分润模式',
    ellipsis: true,
    width: 100,
    customRender: (text) => shareMap[text] || '/',
  },
  {
    dataIndex: 'price',
    title: '单价',
    ellipsis: true,
    width: 100,
    customRender: (text) => text || '/',
  },
  {
    dataIndex: 'remark',
    title: '备注分润',
    ellipsis: true,
    width: 100,
    customRender: (text) => text || '/',
  },
  {
    dataIndex: 'loanAssistanceStatus',
    title: '机构推送',
    ellipsis: true,
    width: 150,
    scopedSlots: { customRender: 'loanAssistanceStatus' },
  },
  {
    dataIndex: 'status',
    title: '状态',
    ellipsis: true,
    width: 150,
    scopedSlots: { customRender: 'status' },
  },
  {
    dataIndex: 'notHitList',
    title: '禁用产品',
    ellipsis: true,
    width: 300,
    scopedSlots: { customRender: 'notHitList' },
  },
  {
    dataIndex: 'apiAuthority',
    title: '权限',
    ellipsis: true,
    width: 100,
    customRender: (text) => text || '/',
  },
  {
    dataIndex: 'secretKey',
    title: '密钥',
    ellipsis: true,
    width: 100,
    customRender: (text) => text || '/',
  },
  {
    title: '操作',
    width: 280,
    align: 'center',
    fixed: 'right',
    dataIndex: 'operation',
    scopedSlots: {
      customRender: 'operation',
    },
  },
];
export const searchProps1 = [
 
  {
    type: 'select',
    value: 'dealType',
    name: '消耗类型',
    selectOptions: [
      {
        label: '增加',
        value: 0,
      },
      {
        label: '减少',
        value: 1,
      },
    ],
    placeholder: '请选择',
    style: {
      width: '180px',
    },
  },
  {
    type: 'date2',
    value: 'time',
    name: '提交时间',
    placeholder: '请选择',
    showTime: true,
    style: {
      width: '360px',
    },
  },
];
export const columns1 = [
  {
    title: '序号',
    dataIndex: 'index',
    width: 70,
    customRender: (text, record, index) => `${index + 1}`,
  },
 

  {
    dataIndex: 'upDownName',
    title: '渠道名称',
    ellipsis: true,
    width: 150,
    customRender: (text) => text || '/',
  },
  {
    dataIndex: 'rechargeType',
    title: '状态',
    ellipsis: true,
    width: 100,
    customRender: (text) => text  === 1 ? '增加' : '减少',
  },
  {
    dataIndex: 'amount',
    title: '金额',
    ellipsis: true,
    width: 120,
    customRender: (text) => text || '/',
  },
  {
    dataIndex: 'remark',
    title: '备注',
    ellipsis: true,
    width: 180,
    customRender: (text) => text || '/',
  },
  {
    dataIndex: 'createTime',
    title: '消耗时间',
    ellipsis: true,
    width: 180,
    customRender: (text) => text ? moment(text).format('YYYY-MM-DD HH:mm:ss') : '/',
  },
];
